package com.atguigu.dga.score.mapper;

import com.atguigu.dga.score.bean.GovernanceAssessGlobal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 治理总考评表 Mapper 接口
 * </p>
 *
 * @author atguigu
 * @since 2023-06-15
 */
@Mapper
public interface GovernanceAssessGlobalMapper extends BaseMapper<GovernanceAssessGlobal> {

    @Select("select" +
            "    #{date} assess_date," +
            "    avg(score_spec_avg) * 10 score_spec," +
            "    avg(score_storage_avg) * 10 score_storage," +
            "    avg(score_calc_avg) * 10 score_calc," +
            "    avg(score_quality_avg) * 10 score_quality," +
            "    avg(score_security_avg) * 10 score_security," +
            "    avg(score_on_type_weight) score," +
            "    count(*) table_num," +
            "    sum(problem_num) problem_num," +
            "    now() create_time" +
            " from governance_assess_table" +
            " where assess_date = #{date}")
    GovernanceAssessGlobal getGlobalScore(String assessDate);
}
